<?php
class Block_m extends MY_Model{
	
	private $_table_lang = 'block_lang';
	function __construct(){
		parent::__construct();
		$this->_table = 'block';
	}
	
	function list_postion($pos){
		$this->_table = 'block b';
		$this->_table_lang = 'block_lang l';
		
		$this->db->select('b.*,l.title as block_title');
		$this->db->join($this->_table_lang,'l.id = b.id');
		$this->db->order_by('b.ordering');
		$this->db->where('b.status',1);	
		$this->db->where('b.position',$pos);
		$this->db->where('l.lang',$this->_lang);
		$model =  parent::get_all();
//		print_r($model);
		foreach($model as $item){
			if($item->block_title){
				$item->title = $item->block_title;
			}
		}
		return $model;
	}
	
	
	
}